package com.zhaoc.web.action;

import com.opensymphony.xwork2.ActionContext;
import com.zhaoc.domain.TakeTime;
import com.zhaoc.service.ITakeTimeService;
import com.zhaoc.web.base.BaseAction;
import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.ParentPackage;
import org.apache.struts2.convention.annotation.Result;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

/**
 * <p>title:com.zhaoc.web.action</p>
 * date:2018/8/5 0005
 * time:22:07
 * author:赵成
 * user:13566
 */
//查询收派时间的
@ParentPackage("json-default")
public class TakeTimeAction extends BaseAction<TakeTime> {

    //获取service对象
    @Autowired
    private ITakeTimeService takeTimeService;

    @Action(value = "take-time",results = {@Result(name = SUCCESS,type = "json")})
    public String findAllTime(){

        List<TakeTime> list =  takeTimeService.findAll();
        //将结果压入栈顶
        ActionContext.getContext().getValueStack().push(list);
        return SUCCESS;
    }
}
